<?php
require_once('../controlador/user_controller.inc_login.php');
require_once('../modelo/user_model.inc_login.php');

@$op = $_REQUEST['op'];

$user_controller = new UserController();

switch($op){
	case 'login':
	
		$username = $_POST['user'];
		$password = $_POST['pass'];
		
		if($user_controller->login($username, $password)){
			header("Location:login.php");
			
			}
			else header("Location:login.php?err=1");
			
			break;
			
			case 'logout':
			
				$user_controller->logout();
				header("Location:../index.php");
			break;
			
			default:
				 header("Location:../index.php");
			break;
	
	}

?>